From e7ddaf5ed15ac324593879d0ff0ace339b06f6da Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonas=20=C3=85dahl?= Date: Sat, 5 Dec 2020 11:13:07 +0100 Subject: [PATCH] x11/surface: Compute size after update too This will sometimes mean a frame is skipped if a resize was requested during the update phase of the frame dispatch. Not doing so can cause trying to allocate a window smaller than the minimum size of the widget. --- gdk/x11/gdksurface-x11.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c index 0348e9b85b..8c65183f5d 100644 --- a/gdk/x11/gdksurface-x11.c +++ b/gdk/x11/gdksurface-x11.c @@ -1002,6 +1002,19 @@ on_frame_clock_before_paint (GdkFrameClock *clock, gdk_x11_surface_begin_frame (surface, FALSE); } +static void +on_frame_clock_after_update (GdkFrameClock *clock, + GdkSurface *surface) +{ + GdkX11Surface *impl = GDK_X11_SURFACE (surface); + + if (impl->compute_size_source_id) + { + g_clear_handle_id (&impl->compute_size_source_id, g_source_remove); + compute_size_idle (surface); + } +} + static void on_frame_clock_after_paint (GdkFrameClock *clock, GdkSurface *surface) @@ -1024,6 +1037,8 @@ connect_frame_clock (GdkSurface *surface) g_signal_connect (frame_clock, "before-paint", G_CALLBACK (on_frame_clock_before_paint), surface); + g_signal_connect_after (frame_clock, "update", + G_CALLBACK (on_frame_clock_after_update), surface); g_signal_connect (frame_clock, "after-paint", G_CALLBACK (on_frame_clock_after_paint), surface); @@ -1043,6 +1058,8 @@ disconnect_frame_clock (GdkSurface *surface) g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_before_paint, surface); + g_signal_handlers_disconnect_by_func (frame_clock, + on_frame_clock_after_update, surface); g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_after_paint, surface); -- 2.30.2